#    Copyright (C) 2011 University of Southern California and
#                       Andrew D. Smith, Philip J. Uren
#
#    Authors: Andrew D. Smith, Philip J. Uren
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

ifndef SMITHLAB_CPP
SMITHLAB_CPP=$(realpath smithlab_cpp)
endif

app_subdirs=progs

all:
	@for i in $(app_subdirs); do \
	        make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) OPT=1; \
	done;

install:
	@for i in $(app_subdirs); do \
	        make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) OPT=1 install; \
	done;

test:
	@for i in $(app_subdirs); do \
	        make -C test SMITHLAB_CPP=$(SMITHLAB_CPP) test; \
	done;
.PHONY: test

clean:
	@for i in $(app_subdirs); do \
	        make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) clean; \
	done;
	@make -C common SMITHLAB_CPP=$(SMITHLAB_CPP) clean;
	@make -C test SMITHLAB_CPP=$(SMITHLAB_CPP) clean;
	@make -C $(SMITHLAB_CPP) SMITHLAB_CPP=$(SMITHLAB_CPP) clean;
	
distclean:
	@for i in $(app_subdirs); do \
	        make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) distclean; \
	done;
	@make -C common SMITHLAB_CPP=$(SMITHLAB_CPP) distclean;
	@make -C test SMITHLAB_CPP=$(SMITHLAB_CPP) distclean;
	@rm Makefile
.PHONY: distclean
	